{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "fee38406",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "0e772d01",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[  7, 106,  23],\n",
       "        [ 14,   1,  25],\n",
       "        [118, 128, 127],\n",
       "        [ 64, 126, 140],\n",
       "        [143, 120, 101],\n",
       "        [126,  75, 119],\n",
       "        [ 30,  29,  78],\n",
       "        [146,  14,  75],\n",
       "        [ 27,  61,  55],\n",
       "        [101,  11, 123],\n",
       "        [139,  29,  84],\n",
       "        [ 35,  84,  78],\n",
       "        [ 74,  90,  98],\n",
       "        [110, 145, 134],\n",
       "        [ 37,  92,  72],\n",
       "        [ 10, 129, 104],\n",
       "        [ 13, 118,  56],\n",
       "        [ 88,  62, 111],\n",
       "        [136,   0,  91],\n",
       "        [ 93,  52,  68],\n",
       "        [ 69,  28,   4],\n",
       "        [ 60, 146,  17],\n",
       "        [ 84,  79, 135],\n",
       "        [ 33,  72,  98],\n",
       "        [ 65,  46, 133],\n",
       "        [ 52,  78,  64],\n",
       "        [ 52,  98,  89],\n",
       "        [ 64, 134,  20],\n",
       "        [ 75,  17,  20],\n",
       "        [ 70,  44,  58],\n",
       "        [111,  33, 111],\n",
       "        [137,  17,  13],\n",
       "        [114,  18, 106],\n",
       "        [ 42,  90, 102],\n",
       "        [124, 137,  26],\n",
       "        [ 13,  74,  70],\n",
       "        [125,  97, 143],\n",
       "        [131,  37,  55],\n",
       "        [ 19,  73,  53],\n",
       "        [ 17,  13,  32],\n",
       "        [141, 103, 112],\n",
       "        [108,   5,   0],\n",
       "        [ 25,  27,  99],\n",
       "        [ 21,  89, 105],\n",
       "        [148,  78,  59],\n",
       "        [ 95,  80,  79],\n",
       "        [ 46,  57, 131],\n",
       "        [115,  75, 108],\n",
       "        [ 20, 125, 146],\n",
       "        [ 15,  52,  54]],\n",
       "\n",
       "       [[  4, 146, 131],\n",
       "        [ 19,  25, 129],\n",
       "        [ 56,  92,  20],\n",
       "        [138,  49, 117],\n",
       "        [ 61, 109,  86],\n",
       "        [ 63,  50,  22],\n",
       "        [ 42, 147,  51],\n",
       "        [144, 104,  79],\n",
       "        [146,  20, 109],\n",
       "        [ 82, 101,  32],\n",
       "        [ 14, 126, 132],\n",
       "        [ 59, 116, 123],\n",
       "        [ 93, 150,  85],\n",
       "        [115,   2,  68],\n",
       "        [143, 129, 143],\n",
       "        [  9,  38,  80],\n",
       "        [149,  77,  50],\n",
       "        [ 34,  48,  96],\n",
       "        [ 64,  17,  56],\n",
       "        [112,  66,  68],\n",
       "        [ 88,  88,  60],\n",
       "        [ 59,  12, 108],\n",
       "        [114,  67,  55],\n",
       "        [149,  98,  52],\n",
       "        [ 66,  68,  32],\n",
       "        [  8, 113,  54],\n",
       "        [108,  37, 109],\n",
       "        [ 51,  52, 106],\n",
       "        [121,  77,  95],\n",
       "        [ 93,   3,  31],\n",
       "        [130,  92,  96],\n",
       "        [ 46,   6, 134],\n",
       "        [ 38,  94, 106],\n",
       "        [ 11,  17, 124],\n",
       "        [ 12, 122,  51],\n",
       "        [ 16,   1, 121],\n",
       "        [ 37,  32, 115],\n",
       "        [  2, 114,  39],\n",
       "        [126,  47,  48],\n",
       "        [ 44,  32,  91],\n",
       "        [ 76, 114,  63],\n",
       "        [ 47, 124, 142],\n",
       "        [ 55,  16,  33],\n",
       "        [ 41, 122,  36],\n",
       "        [ 36,  32,  52],\n",
       "        [ 91,   9,  37],\n",
       "        [ 72,  64,  72],\n",
       "        [114, 129,  58],\n",
       "        [108, 143,  30],\n",
       "        [ 23, 109,  70]],\n",
       "\n",
       "       [[129,  33,  76],\n",
       "        [114, 149,  94],\n",
       "        [ 73,  25, 135],\n",
       "        [143, 148,  88],\n",
       "        [  6, 110, 108],\n",
       "        [  7,  33,  47],\n",
       "        [ 78,  28, 140],\n",
       "        [144,  86, 120],\n",
       "        [124,  93, 127],\n",
       "        [ 55, 137,  46],\n",
       "        [ 82,  22,  44],\n",
       "        [ 49, 134,  66],\n",
       "        [103,  40,  16],\n",
       "        [  4,   6,  50],\n",
       "        [ 53,  98,  14],\n",
       "        [ 76,  24,   2],\n",
       "        [136,  44,  42],\n",
       "        [ 54,  16,  69],\n",
       "        [149, 119,  50],\n",
       "        [ 50,  99,   9],\n",
       "        [ 41,  12,  41],\n",
       "        [  2,  41,  51],\n",
       "        [ 23, 105, 106],\n",
       "        [140, 120, 130],\n",
       "        [130,  84, 106],\n",
       "        [135,  82,  58],\n",
       "        [ 59,   9,  75],\n",
       "        [ 73,   3,  39],\n",
       "        [ 12,   5,  97],\n",
       "        [  9,   6,  41],\n",
       "        [ 72, 150, 140],\n",
       "        [ 61, 126,  43],\n",
       "        [101,  16,  17],\n",
       "        [119,  95,   0],\n",
       "        [ 71,  81,  20],\n",
       "        [ 51, 119,   8],\n",
       "        [ 66,  38,  72],\n",
       "        [ 67,  42, 138],\n",
       "        [ 45,  59,  25],\n",
       "        [ 45, 146,  74],\n",
       "        [  3, 110, 123],\n",
       "        [ 82,  52,  65],\n",
       "        [116,  87,  64],\n",
       "        [ 63,  93,  90],\n",
       "        [ 38,  52,   5],\n",
       "        [108,  23, 113],\n",
       "        [ 95,   4, 112],\n",
       "        [ 98,  20,  88],\n",
       "        [134,  23,   2],\n",
       "        [ 51,  29,  34]],\n",
       "\n",
       "       [[124,  75,  22],\n",
       "        [ 59, 119,  47],\n",
       "        [ 83,   5,  26],\n",
       "        [111,  23,  69],\n",
       "        [ 47,  14,  89],\n",
       "        [ 71,  56,  18],\n",
       "        [ 49,  53,  65],\n",
       "        [110,  67, 128],\n",
       "        [ 76, 105,  74],\n",
       "        [ 95,  65, 130],\n",
       "        [ 55,  72,  79],\n",
       "        [127, 133, 137],\n",
       "        [110,  40,  74],\n",
       "        [145,  96,  78],\n",
       "        [ 71, 130,  92],\n",
       "        [  6,  67,  48],\n",
       "        [110, 114, 104],\n",
       "        [ 17, 120,  57],\n",
       "        [ 12,  16,  83],\n",
       "        [ 16, 118, 129],\n",
       "        [ 37,  77, 124],\n",
       "        [ 81, 132,  38],\n",
       "        [ 11, 137,  30],\n",
       "        [ 17, 116, 141],\n",
       "        [ 67, 121, 117],\n",
       "        [ 17,  67,  57],\n",
       "        [ 44, 111, 110],\n",
       "        [ 10,  55, 146],\n",
       "        [148,  34,   7],\n",
       "        [  2, 139, 147],\n",
       "        [113, 142, 143],\n",
       "        [118, 126, 102],\n",
       "        [ 24,  63,  91],\n",
       "        [ 40, 139, 134],\n",
       "        [ 59, 118,  67],\n",
       "        [140,  45, 124],\n",
       "        [ 87,  25,   1],\n",
       "        [ 31,  42, 115],\n",
       "        [114,  23,  39],\n",
       "        [ 58,  65,  29],\n",
       "        [ 91, 144,  12],\n",
       "        [143,  84, 135],\n",
       "        [106, 132, 133],\n",
       "        [132,  88, 150],\n",
       "        [ 55,  89, 114],\n",
       "        [ 25, 150,  21],\n",
       "        [ 35, 150,  50],\n",
       "        [ 67, 132,  49],\n",
       "        [100,  46,  83],\n",
       "        [ 28,  50, 146]],\n",
       "\n",
       "       [[  4,  99,  39],\n",
       "        [147,  82,  73],\n",
       "        [ 58,  15, 113],\n",
       "        [109, 136,   2],\n",
       "        [ 14, 106, 146],\n",
       "        [ 23, 146,  76],\n",
       "        [ 79,   2, 110],\n",
       "        [ 40,  89,  77],\n",
       "        [145, 130, 148],\n",
       "        [114, 121,  65],\n",
       "        [102,  16,  79],\n",
       "        [ 99, 108,  69],\n",
       "        [104, 123,  57],\n",
       "        [ 47, 115, 121],\n",
       "        [ 11,  70, 117],\n",
       "        [138,  57,  54],\n",
       "        [ 31,  28,  94],\n",
       "        [ 85, 127, 139],\n",
       "        [ 33,  48,   9],\n",
       "        [140,  74,  45],\n",
       "        [ 86,  81, 103],\n",
       "        [ 76,  82,  11],\n",
       "        [110,  99,  87],\n",
       "        [125, 103,  89],\n",
       "        [107, 136,  86],\n",
       "        [ 53, 113, 113],\n",
       "        [ 64,  50, 146],\n",
       "        [ 88,  17,   3],\n",
       "        [ 27,  40,  98],\n",
       "        [ 86,  82,  27],\n",
       "        [ 96, 134,   5],\n",
       "        [ 12,  28, 124],\n",
       "        [ 78,   2,  10],\n",
       "        [ 67,  23, 115],\n",
       "        [ 68,  49,   5],\n",
       "        [ 90,  59,  95],\n",
       "        [ 16, 112,  11],\n",
       "        [ 66,  81,  57],\n",
       "        [ 80,  93, 125],\n",
       "        [113,   5,  99],\n",
       "        [ 70,  70, 111],\n",
       "        [ 92,  92,  76],\n",
       "        [ 58,   7, 117],\n",
       "        [ 80,  66, 108],\n",
       "        [142, 120, 121],\n",
       "        [132,  72,  86],\n",
       "        [146, 138,   0],\n",
       "        [ 78,  34,   5],\n",
       "        [  8,  24,   3],\n",
       "        [ 63,  39,  73]],\n",
       "\n",
       "       [[ 85,  39, 107],\n",
       "        [ 34,  37, 146],\n",
       "        [ 83,  89,  26],\n",
       "        [ 84,  73,  28],\n",
       "        [ 42,  32, 130],\n",
       "        [ 79,  91,  51],\n",
       "        [ 31, 132,  38],\n",
       "        [102, 120,  50],\n",
       "        [142,  74, 139],\n",
       "        [ 53,   0,  74],\n",
       "        [150,  86,  85],\n",
       "        [ 67,  92,  92],\n",
       "        [ 95, 149, 133],\n",
       "        [ 92, 136, 138],\n",
       "        [ 48,   7, 149],\n",
       "        [118,  60,  80],\n",
       "        [125, 150, 135],\n",
       "        [106,   6,  11],\n",
       "        [ 89, 119,  18],\n",
       "        [137, 116, 118],\n",
       "        [ 65,  39, 129],\n",
       "        [  1,  93, 107],\n",
       "        [121,   2,  67],\n",
       "        [ 24,  43,  29],\n",
       "        [ 59,   8,  93],\n",
       "        [  4, 116, 114],\n",
       "        [122, 109,  96],\n",
       "        [ 98,  87,  30],\n",
       "        [140,  66,  11],\n",
       "        [ 24,   9, 124],\n",
       "        [  4,  50, 120],\n",
       "        [124,  39,  23],\n",
       "        [138, 139, 143],\n",
       "        [ 64,  97, 116],\n",
       "        [ 97, 120, 136],\n",
       "        [120,   5,  21],\n",
       "        [ 53,  11, 112],\n",
       "        [133, 111,  14],\n",
       "        [ 78,  13, 133],\n",
       "        [ 31,  19, 131],\n",
       "        [ 54,  41,  65],\n",
       "        [ 35,  26,  75],\n",
       "        [136, 105,  75],\n",
       "        [ 27,  42,  58],\n",
       "        [ 51,  66, 147],\n",
       "        [ 68, 117,   8],\n",
       "        [ 59,  95,  36],\n",
       "        [ 65, 112, 129],\n",
       "        [ 70,  74,   2],\n",
       "        [123, 101, 128]]])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "class_all = np.random.randint(0,151,size=(6,50,3))\n",
    "class_all"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "2fa28378",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[  7, 106,  23],\n",
       "       [ 14,   1,  25],\n",
       "       [118, 128, 127],\n",
       "       [ 64, 126, 140],\n",
       "       [143, 120, 101],\n",
       "       [126,  75, 119],\n",
       "       [ 30,  29,  78],\n",
       "       [146,  14,  75],\n",
       "       [ 27,  61,  55],\n",
       "       [101,  11, 123],\n",
       "       [139,  29,  84],\n",
       "       [ 35,  84,  78],\n",
       "       [ 74,  90,  98],\n",
       "       [110, 145, 134],\n",
       "       [ 37,  92,  72],\n",
       "       [ 10, 129, 104],\n",
       "       [ 13, 118,  56],\n",
       "       [ 88,  62, 111],\n",
       "       [136,   0,  91],\n",
       "       [ 93,  52,  68],\n",
       "       [ 69,  28,   4],\n",
       "       [ 60, 146,  17],\n",
       "       [ 84,  79, 135],\n",
       "       [ 33,  72,  98],\n",
       "       [ 65,  46, 133],\n",
       "       [ 52,  78,  64],\n",
       "       [ 52,  98,  89],\n",
       "       [ 64, 134,  20],\n",
       "       [ 75,  17,  20],\n",
       "       [ 70,  44,  58],\n",
       "       [111,  33, 111],\n",
       "       [137,  17,  13],\n",
       "       [114,  18, 106],\n",
       "       [ 42,  90, 102],\n",
       "       [124, 137,  26],\n",
       "       [ 13,  74,  70],\n",
       "       [125,  97, 143],\n",
       "       [131,  37,  55],\n",
       "       [ 19,  73,  53],\n",
       "       [ 17,  13,  32],\n",
       "       [141, 103, 112],\n",
       "       [108,   5,   0],\n",
       "       [ 25,  27,  99],\n",
       "       [ 21,  89, 105],\n",
       "       [148,  78,  59],\n",
       "       [ 95,  80,  79],\n",
       "       [ 46,  57, 131],\n",
       "       [115,  75, 108],\n",
       "       [ 20, 125, 146],\n",
       "       [ 15,  52,  54],\n",
       "       [  4, 146, 131],\n",
       "       [ 19,  25, 129],\n",
       "       [ 56,  92,  20],\n",
       "       [138,  49, 117],\n",
       "       [ 61, 109,  86],\n",
       "       [ 63,  50,  22],\n",
       "       [ 42, 147,  51],\n",
       "       [144, 104,  79],\n",
       "       [146,  20, 109],\n",
       "       [ 82, 101,  32],\n",
       "       [ 14, 126, 132],\n",
       "       [ 59, 116, 123],\n",
       "       [ 93, 150,  85],\n",
       "       [115,   2,  68],\n",
       "       [143, 129, 143],\n",
       "       [  9,  38,  80],\n",
       "       [149,  77,  50],\n",
       "       [ 34,  48,  96],\n",
       "       [ 64,  17,  56],\n",
       "       [112,  66,  68],\n",
       "       [ 88,  88,  60],\n",
       "       [ 59,  12, 108],\n",
       "       [114,  67,  55],\n",
       "       [149,  98,  52],\n",
       "       [ 66,  68,  32],\n",
       "       [  8, 113,  54],\n",
       "       [108,  37, 109],\n",
       "       [ 51,  52, 106],\n",
       "       [121,  77,  95],\n",
       "       [ 93,   3,  31],\n",
       "       [130,  92,  96],\n",
       "       [ 46,   6, 134],\n",
       "       [ 38,  94, 106],\n",
       "       [ 11,  17, 124],\n",
       "       [ 12, 122,  51],\n",
       "       [ 16,   1, 121],\n",
       "       [ 37,  32, 115],\n",
       "       [  2, 114,  39],\n",
       "       [126,  47,  48],\n",
       "       [ 44,  32,  91],\n",
       "       [ 76, 114,  63],\n",
       "       [ 47, 124, 142],\n",
       "       [ 55,  16,  33],\n",
       "       [ 41, 122,  36],\n",
       "       [ 36,  32,  52],\n",
       "       [ 91,   9,  37],\n",
       "       [ 72,  64,  72],\n",
       "       [114, 129,  58],\n",
       "       [108, 143,  30],\n",
       "       [ 23, 109,  70],\n",
       "       [129,  33,  76],\n",
       "       [114, 149,  94],\n",
       "       [ 73,  25, 135],\n",
       "       [143, 148,  88],\n",
       "       [  6, 110, 108],\n",
       "       [  7,  33,  47],\n",
       "       [ 78,  28, 140],\n",
       "       [144,  86, 120],\n",
       "       [124,  93, 127],\n",
       "       [ 55, 137,  46],\n",
       "       [ 82,  22,  44],\n",
       "       [ 49, 134,  66],\n",
       "       [103,  40,  16],\n",
       "       [  4,   6,  50],\n",
       "       [ 53,  98,  14],\n",
       "       [ 76,  24,   2],\n",
       "       [136,  44,  42],\n",
       "       [ 54,  16,  69],\n",
       "       [149, 119,  50],\n",
       "       [ 50,  99,   9],\n",
       "       [ 41,  12,  41],\n",
       "       [  2,  41,  51],\n",
       "       [ 23, 105, 106],\n",
       "       [140, 120, 130],\n",
       "       [130,  84, 106],\n",
       "       [135,  82,  58],\n",
       "       [ 59,   9,  75],\n",
       "       [ 73,   3,  39],\n",
       "       [ 12,   5,  97],\n",
       "       [  9,   6,  41],\n",
       "       [ 72, 150, 140],\n",
       "       [ 61, 126,  43],\n",
       "       [101,  16,  17],\n",
       "       [119,  95,   0],\n",
       "       [ 71,  81,  20],\n",
       "       [ 51, 119,   8],\n",
       "       [ 66,  38,  72],\n",
       "       [ 67,  42, 138],\n",
       "       [ 45,  59,  25],\n",
       "       [ 45, 146,  74],\n",
       "       [  3, 110, 123],\n",
       "       [ 82,  52,  65],\n",
       "       [116,  87,  64],\n",
       "       [ 63,  93,  90],\n",
       "       [ 38,  52,   5],\n",
       "       [108,  23, 113],\n",
       "       [ 95,   4, 112],\n",
       "       [ 98,  20,  88],\n",
       "       [134,  23,   2],\n",
       "       [ 51,  29,  34],\n",
       "       [124,  75,  22],\n",
       "       [ 59, 119,  47],\n",
       "       [ 83,   5,  26],\n",
       "       [111,  23,  69],\n",
       "       [ 47,  14,  89],\n",
       "       [ 71,  56,  18],\n",
       "       [ 49,  53,  65],\n",
       "       [110,  67, 128],\n",
       "       [ 76, 105,  74],\n",
       "       [ 95,  65, 130],\n",
       "       [ 55,  72,  79],\n",
       "       [127, 133, 137],\n",
       "       [110,  40,  74],\n",
       "       [145,  96,  78],\n",
       "       [ 71, 130,  92],\n",
       "       [  6,  67,  48],\n",
       "       [110, 114, 104],\n",
       "       [ 17, 120,  57],\n",
       "       [ 12,  16,  83],\n",
       "       [ 16, 118, 129],\n",
       "       [ 37,  77, 124],\n",
       "       [ 81, 132,  38],\n",
       "       [ 11, 137,  30],\n",
       "       [ 17, 116, 141],\n",
       "       [ 67, 121, 117],\n",
       "       [ 17,  67,  57],\n",
       "       [ 44, 111, 110],\n",
       "       [ 10,  55, 146],\n",
       "       [148,  34,   7],\n",
       "       [  2, 139, 147],\n",
       "       [113, 142, 143],\n",
       "       [118, 126, 102],\n",
       "       [ 24,  63,  91],\n",
       "       [ 40, 139, 134],\n",
       "       [ 59, 118,  67],\n",
       "       [140,  45, 124],\n",
       "       [ 87,  25,   1],\n",
       "       [ 31,  42, 115],\n",
       "       [114,  23,  39],\n",
       "       [ 58,  65,  29],\n",
       "       [ 91, 144,  12],\n",
       "       [143,  84, 135],\n",
       "       [106, 132, 133],\n",
       "       [132,  88, 150],\n",
       "       [ 55,  89, 114],\n",
       "       [ 25, 150,  21],\n",
       "       [ 35, 150,  50],\n",
       "       [ 67, 132,  49],\n",
       "       [100,  46,  83],\n",
       "       [ 28,  50, 146],\n",
       "       [  4,  99,  39],\n",
       "       [147,  82,  73],\n",
       "       [ 58,  15, 113],\n",
       "       [109, 136,   2],\n",
       "       [ 14, 106, 146],\n",
       "       [ 23, 146,  76],\n",
       "       [ 79,   2, 110],\n",
       "       [ 40,  89,  77],\n",
       "       [145, 130, 148],\n",
       "       [114, 121,  65],\n",
       "       [102,  16,  79],\n",
       "       [ 99, 108,  69],\n",
       "       [104, 123,  57],\n",
       "       [ 47, 115, 121],\n",
       "       [ 11,  70, 117],\n",
       "       [138,  57,  54],\n",
       "       [ 31,  28,  94],\n",
       "       [ 85, 127, 139],\n",
       "       [ 33,  48,   9],\n",
       "       [140,  74,  45],\n",
       "       [ 86,  81, 103],\n",
       "       [ 76,  82,  11],\n",
       "       [110,  99,  87],\n",
       "       [125, 103,  89],\n",
       "       [107, 136,  86],\n",
       "       [ 53, 113, 113],\n",
       "       [ 64,  50, 146],\n",
       "       [ 88,  17,   3],\n",
       "       [ 27,  40,  98],\n",
       "       [ 86,  82,  27],\n",
       "       [ 96, 134,   5],\n",
       "       [ 12,  28, 124],\n",
       "       [ 78,   2,  10],\n",
       "       [ 67,  23, 115],\n",
       "       [ 68,  49,   5],\n",
       "       [ 90,  59,  95],\n",
       "       [ 16, 112,  11],\n",
       "       [ 66,  81,  57],\n",
       "       [ 80,  93, 125],\n",
       "       [113,   5,  99],\n",
       "       [ 70,  70, 111],\n",
       "       [ 92,  92,  76],\n",
       "       [ 58,   7, 117],\n",
       "       [ 80,  66, 108],\n",
       "       [142, 120, 121],\n",
       "       [132,  72,  86],\n",
       "       [146, 138,   0],\n",
       "       [ 78,  34,   5],\n",
       "       [  8,  24,   3],\n",
       "       [ 63,  39,  73],\n",
       "       [ 85,  39, 107],\n",
       "       [ 34,  37, 146],\n",
       "       [ 83,  89,  26],\n",
       "       [ 84,  73,  28],\n",
       "       [ 42,  32, 130],\n",
       "       [ 79,  91,  51],\n",
       "       [ 31, 132,  38],\n",
       "       [102, 120,  50],\n",
       "       [142,  74, 139],\n",
       "       [ 53,   0,  74],\n",
       "       [150,  86,  85],\n",
       "       [ 67,  92,  92],\n",
       "       [ 95, 149, 133],\n",
       "       [ 92, 136, 138],\n",
       "       [ 48,   7, 149],\n",
       "       [118,  60,  80],\n",
       "       [125, 150, 135],\n",
       "       [106,   6,  11],\n",
       "       [ 89, 119,  18],\n",
       "       [137, 116, 118],\n",
       "       [ 65,  39, 129],\n",
       "       [  1,  93, 107],\n",
       "       [121,   2,  67],\n",
       "       [ 24,  43,  29],\n",
       "       [ 59,   8,  93],\n",
       "       [  4, 116, 114],\n",
       "       [122, 109,  96],\n",
       "       [ 98,  87,  30],\n",
       "       [140,  66,  11],\n",
       "       [ 24,   9, 124],\n",
       "       [  4,  50, 120],\n",
       "       [124,  39,  23],\n",
       "       [138, 139, 143],\n",
       "       [ 64,  97, 116],\n",
       "       [ 97, 120, 136],\n",
       "       [120,   5,  21],\n",
       "       [ 53,  11, 112],\n",
       "       [133, 111,  14],\n",
       "       [ 78,  13, 133],\n",
       "       [ 31,  19, 131],\n",
       "       [ 54,  41,  65],\n",
       "       [ 35,  26,  75],\n",
       "       [136, 105,  75],\n",
       "       [ 27,  42,  58],\n",
       "       [ 51,  66, 147],\n",
       "       [ 68, 117,   8],\n",
       "       [ 59,  95,  36],\n",
       "       [ 65, 112, 129],\n",
       "       [ 70,  74,   2],\n",
       "       [123, 101, 128]])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score =  np.concatenate(class_all)    \n",
    "score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "7b0af9c6",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1],\n",
       "       [0],\n",
       "       [0],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [1],\n",
       "       [0],\n",
       "       [1]])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sex = np.random.randint(0,2,size=(300,1))  # 生成性别数组sex\n",
    "sex"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "7fc8623c",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[  0,   7, 106,  23],\n",
       "       [  1,  14,   1,  25],\n",
       "       [  1, 118, 128, 127],\n",
       "       ...,\n",
       "       [  1,  65, 112, 129],\n",
       "       [  0,  70,  74,   2],\n",
       "       [  1, 123, 101, 128]])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = np.hstack((sex,score))       #  水平叠加数组sex和score得到data\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "f7129512",
   "metadata": {},
   "outputs": [],
   "source": [
    "cond = data[:,0]== 1    # 生成条件：男生"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "627ef87e",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 求男生成绩各科最小值、最大值、平均分、中位数、标准差\n",
    "male_min = data[cond].min(axis=0)\n",
    "male_max = data[cond].max(axis=0)\n",
    "male_mean = data[cond].mean(axis=0).round(2)\n",
    "male_median = np.median(data[cond],axis=0)\n",
    "male_std = data[cond].std(axis=0).round(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "058e4920",
   "metadata": {},
   "outputs": [],
   "source": [
    "cond = data[:,0] == 0  # 生成条件：女生"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "1fb99c06",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 求女生成绩各科最小值、最大值、平均分、中位数、标准差\n",
    "female_min = data[cond].min(axis=0)\n",
    "female_max = data[cond].max(axis=0)\n",
    "female_mean = data[cond].mean(axis=0).round(2)\n",
    "female_median = np.median(data[cond],axis=0)\n",
    "female_std = data[cond].std(axis=0).round(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "5c30765f",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 生成标题数组\n",
    "item = np.array([[\"最小值\"],[\"最大值\"],[\"平均值\"],[\"中位数\"],[\"标准差\"]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "6b671fc0",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 男、女生成绩统计结果分别合并\n",
    "female_statistic = np.vstack((female_min,female_max,female_mean,female_median,female_std))\n",
    "male_statistic = np.vstack((male_min,male_max,male_mean,male_median,male_std))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "5c406dea",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 将标题和成绩统计结果合并\n",
    "result_female = np.hstack((item,female_statistic))\n",
    "result_male = np.hstack((item,male_statistic))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "9fde506c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "女生成绩:\n",
      "统计项          Python       数学           语文          \n",
      "最小值          2.0          0.0          0.0         \n",
      "最大值          150.0        150.0        150.0       \n",
      "平均值          72.09        75.56        73.82       \n",
      "中位数          68.0         78.0         73.0        \n",
      "标准差          43.53        44.29        44.46       \n",
      "\n",
      "男生成绩:\n",
      "统计项          Python       数学           语文          \n",
      "最小值          1.0          0.0          0.0         \n",
      "最大值          146.0        149.0        148.0       \n",
      "平均值          76.7         71.43        82.15       \n",
      "中位数          74.0         72.0         86.0        \n",
      "标准差          42.16        44.4         41.07       \n"
     ]
    }
   ],
   "source": [
    "# 打印输出统计结果：\n",
    "print(\"女生成绩:\")\n",
    "print(\"统计项\".ljust(12),\"Python\".ljust(12),\"数学\".ljust(12),\"语文\".ljust(12))\n",
    "for row in range (5):\n",
    "    print(result_female[row,0].ljust(12),str(result_female[row,2]).ljust(12),str(result_female[row,3]).ljust(12),str(result_female[row,4]).ljust(12))\n",
    "print()\n",
    "print(\"男生成绩:\")\n",
    "print(\"统计项\".ljust(12),\"Python\".ljust(12),\"数学\".ljust(12),\"语文\".ljust(12))\n",
    "for row in range (5):\n",
    "    print(result_male[row,0].ljust(12),str(result_male[row,2]).ljust(12),str(result_male[row,3]).ljust(12),str(result_male[row,4]).ljust(12))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "45843c34",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
